package MDVRPTW;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

import javax.naming.LinkLoopException;

public class Car implements Cloneable{

	//车辆编号
	private int num;
	//车辆所属车场编号
	private int Dno;
	//车辆当前负重
	private double load;
	//车辆当前货物体积
	private double capacity;
	//车辆路径
	private LinkedList<Customer> route=new LinkedList<Customer>();
	//车辆路径中各顾客结束服务时间
	private LinkedList<Double> endTime=new LinkedList<Double>();
	//车辆运行路程
	private double distance;
	//路径中违反时间窗约束的时间量
	private double voilation;
	
	public int getNum() {
		return num;
	}
	public void setNum(int num) {
		this.num = num;
	}
	public int getDno() {
		return Dno;
	}
	public void setDno(int dno) {
		Dno = dno;
	}
	public double getLoad() {
		return load;
	}
	public void setLoad(double load) {
		this.load = load;
	}
	public double getCapacity() {
		return capacity;
	}
	public void setCapacity(double capacity) {
		this.capacity = capacity;
	}
	public LinkedList<Customer> getRoute() {
		return route;
	}
	public void setRoute(LinkedList<Customer> route) {
		this.route = route;
	}
	public LinkedList<Double> getEndTime() {
		return endTime;
	}
	public void setEndTime(LinkedList<Double> endTime) {
		this.endTime = endTime;
	}
	public double getDistance() {
		return distance;
	}
	public void setDistance(double distance) {
		this.distance = distance;
	}
	public double getVoilation() {
		return voilation;
	}
	public void setVoilation(double voilation) {
		this.voilation = voilation;
	}
	
	//输出当前车辆路径的方法
	public void print(){
		System.out.println("-------------------------------------------------------------------------------------------------");
		System.out.println(this.Dno+"-"+this.num+"	:"+(this.route.size()-2)+"个");
		for(int i=0;i<this.route.size();i++){
			System.out.print(this.route.get(i).getNum()+"  ");
		}
		System.out.println();
		System.out.println("-------------------------------------------------------------------------------------------------");
	}
	//初始构造方法
	public Car() {
	}
	//克隆一条路线
	public Car(Car car) {
		this.num=car.getNum();
		this.capacity=car.getCapacity();
		this.distance=car.getDistance();
		this.Dno=car.getDno();
		this.load=car.getLoad();
		this.voilation=car.getVoilation();
		this.endTime=(LinkedList<Double>) car.getEndTime().clone();
		this.route=(LinkedList<Customer>) car.getRoute().clone();
	}
}
